﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using OpenBlog.IDAL;
using OpenBlog.Entity;
using System.Data.SqlClient;

namespace OpenBlog.SQLServerDAL
{
    public class BlogInfoDAL : IBlogInfoDAL
    {
        public void CreateBlogInfo(BlogInfo blogInfo)
        {
            SqlParameter[] param = new SqlParameter[6];
            param[0] = new SqlParameter("@TITLE", blogInfo.TITLE);
            param[1] = new SqlParameter("@COMMENT", blogInfo.COMMENT);
            param[2] = new SqlParameter("@THEME", blogInfo.THEME);
            param[3] = new SqlParameter("@LANGUAGE", blogInfo.TITLE);
            param[4] = new SqlParameter("@PASSWORD", blogInfo.LANGUAGE);
            param[5] = new SqlParameter("@ARTICLECOUNT", blogInfo.ARTICLECOUNT);

            SqlHelper.ExecuteNonQuery(SqlHelper.ConntectionString, "dbo.InsertBlogInfo", param);
        }

        public void UpdateBlogInfo(BlogInfo blogInfo)
        {
            SqlParameter[] param = new SqlParameter[6];
            param[0] = new SqlParameter("@TITLE", blogInfo.TITLE);
            param[1] = new SqlParameter("@COMMENT", blogInfo.COMMENT);
            param[2] = new SqlParameter("@THEME", blogInfo.THEME);
            param[3] = new SqlParameter("@LANGUAGE", blogInfo.TITLE);
            param[4] = new SqlParameter("@PASSWORD", blogInfo.LANGUAGE);
            param[5] = new SqlParameter("@ARTICLECOUNT", blogInfo.ARTICLECOUNT);

            SqlHelper.ExecuteNonQuery(SqlHelper.ConntectionString, "dbo.UpdateBlogInfo", param);
        }
    }
}
